﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Text;

namespace ThoughtWorks.QRCode
{
    public partial class QRCodeResource : Component
    {
        /// <summary>
        /// 资源管理器
        /// </summary>
        private static System.Resources.ResourceManager manager = new System.Resources.ResourceManager(typeof(QRCodeResource));

        public QRCodeResource()
        {
            InitializeComponent();
        }

        public QRCodeResource(IContainer container)
        {
            container.Add(this);

            InitializeComponent();
        }

        /// <summary>
        /// 获取文件流
        /// </summary>
        /// <param name="filename"></param>
        /// <returns></returns>
        public static System.IO.MemoryStream GetStream(string filename)
        {
            System.IO.MemoryStream stream = new System.IO.MemoryStream();
            object obj = manager.GetObject(filename);
            if (obj != null && obj is byte[])
                stream = new System.IO.MemoryStream((byte[])obj);
            return stream;
        }
    }
}
